home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / comm / bbs / cit_src_7H21.lha / ctdl.h < prev    next >
C/C++ Source or Header  |  1997-08-21  |  44KB  |  1,186 lines

  1. /*
  2. *       Ctdl.h
  3. *
  4. * #include file for all Citadel C files.
  5. * Now includes only #defines and structs.
  6. */
  7. #include "stdio.h"
  8. #include "slist.h"
  9. #include "sysdep.h"
  10. #define CTDL_HEADER     1
  11. /*
  12. *       History
  13. *
  14. * 85Oct16 HAW  Add code for OFFICE-STUFF parameter.
  15. * 85Aug29 HAW  Install code to allow double msg files for autobackup.
  16. * 85Jun19 HAW  Implant exit values so batch files can be made useful.
  17. * 85May27 HAW  Start adding networking gunk.
  18. * 85May22 HAW  MAXLOGTAB now sysop selectable.
  19. * 85May06 HAW  Add daily bailout parameter.
  20. * 85May05 HAW  Add SYSDISK parameter.
  21. * 85Mar20 HAW  Add timestamp code.
  22. * 85Feb21 HAW  Add directory names.
  23. * 85Feb20 HAW  Implement IMPERVIOUS flag.
  24. * 85Feb18 HAW  Insert global variables for baud search.
  25. * 85Jan20 HAW  Insert code to read from system clock.
  26. * 84Aug30 HAW  Begin conversion to MS-DOS.
  27. */
  28. #define NAMESIZE         20       /* length of room names                 */
  29. #define SECTSIZE        128       /* Size of a sector (XMODEM)            */
  30. #define YM_BLOCK_SIZE  1024       /* Size of a sector (YMODEM)            */
  31. typedef char label[NAMESIZE];    /* Semi-generic                         */
  32. /*
  33. * Citadel programs use readSysTab() and writeSysTab() to write an
  34. * image of the external variables in RAM to disk, and later restore
  35. * it.  The image is stored in ctdlTabl.sys .  If ctdlTabl.sys is lost,
  36. * confg.com will automatically reconstruct the hard way when invoked,
  37. * and write a new ctdlTabl.sys out when finished.  CtdlTabl.sys is
  38. * always destroyed after reading, to minimize the possibility of
  39. * reading an out-of-date version.  In general, the technique works
  40. * well and saves time and head-banging on bootup.  You should,
  41. * however, note carefully the following caution:
  42. *  o  Whenever you change the declarations in Ctdl.h you should:
  43. *   -->  destroy the current ctdlTabl.sys file
  44. *   -->  recompile and reload all citadel programs which access
  45. *        ctdlTabl.sys -- currently citadel.com & configur.com
  46. *   -->  use configur.com to build a new ctdlTabl.sys file
  47. *
  48. * If you ignore these warnings, little pixies will prick you in your
  49. * sleep for the rest of your life.
  50. */
  51. struct MiscBool
  52.   {
  53.   BOOLEAN_FLAG(HoldOnLost);   /* Save entries when carrier lost?      */
  54.   BOOLEAN_FLAG(mirror);       /* mirror msg option?                   */
  55.   BOOLEAN_FLAG(unlogEnterOk); /* TRUE if OK to enter messages anon    */
  56.   BOOLEAN_FLAG(unlogReadOk);  /* TRUE if unlogged folks can read mess */
  57.   BOOLEAN_FLAG(unlogLoginOk); /* TRUE if spontan. new accounts ok.    */
  58.   BOOLEAN_FLAG(nonAideRoomOk);/* TRUE general folks can make rooms    */
  59.   BOOLEAN_FLAG(noMail);       /* TRUE if mail is not allowed          */
  60.   BOOLEAN_FLAG(noChat);       /* TRUE if not accepting chats          */
  61.  
  62.   BOOLEAN_FLAG(netParticipant);/* TRUE if participating in the net    */
  63.   BOOLEAN_FLAG(aideSeeAll);   /* TRUE if aides see private rooms      */
  64.   BOOLEAN_FLAG(debug);        /* TRUE for debug phase                 */
  65.   BOOLEAN_FLAG(NetDft);       /* TRUE if new users get net privs      */
  66.   BOOLEAN_FLAG(SysopEditor);  /* TRUE if there is a sysop editor      */
  67.   BOOLEAN_FLAG(IsDoor);       /* TRUE if this installation is a door  */
  68.   BOOLEAN_FLAG(RouteMail);    /* TRUE if we will route mail           */
  69.   BOOLEAN_FLAG(DoorDft);      /* TRUE if new users get door privs     */
  70.  
  71.   BOOLEAN_FLAG(AnonSessions); /* TRUE if anonymous calls are recorded */
  72.   BOOLEAN_FLAG(DL_Default);   /* TRUE if new callers get dl privs     */
  73.   BOOLEAN_FLAG(NetScanBad);   /* TRUE if net msgs scanned for bad words*/
  74.   BOOLEAN_FLAG(QwkMail);      /* TRUE if we support qwk packets        */
  75.   };
  76. /* Let's begin by defining the configuration struct.    */
  77. /* This is part of the contents of ctdltabl.sys         */
  78. #define MAX_DIAL_STRINGS  (7)
  79. typedef struct
  80.   {
  81.   SECTOR_ID maxMSector; /* Max # of sectors (simulated)         */
  82.   MSG_NUMBER oldest;    /* 32-bit ID# of first message in system*/
  83.   MSG_NUMBER newest;    /* 32-bit ID# of last  message in system*/
  84.   UNS_16  nodeName;   /* Offsets in codeBuf                   */
  85.   UNS_16  nodeTitle;
  86.   UNS_16  nodeId;
  87.   UNS_16  nodeDomain;   /* home domain of this installation */
  88.   UNS_16  bRoom;
  89.   UNS_16  MainFloor;    /* Main floor name                      */
  90.   UNS_16  DialPrefixes[MAX_DIAL_STRINGS], netSuffix;
  91.   NET_AREA receptArea;        /* Area to accept files sent via net here */
  92.   int  sizeArea;              /* How much room to allow for same (K)  */
  93.   int  maxFileSize;           /* In K                                 */
  94.   label SysopName;
  95.   int  cryptSeed;
  96.   UNS_16 InitColumns;
  97.   UNS_16 LoginAttempts;
  98.   char Audit;                 /* 0=none, 1=normal, 2=no net sessions  */
  99.   DependentData DepData;
  100.   char filter[128];           /* input character translation table    */
  101.   SYS_AREA homeArea,    /* Location: Help files                 */
  102.   msgArea,    /* Message file                         */
  103.   msg2Area,   /* Mirror message file                  */
  104.   logArea,    /* Log file                             */
  105.   roomArea,   /* Room file                            */
  106.   netArea,    /* Net files                            */
  107.   domainArea, /* Domain directories                   */
  108.   auditArea,  /* General auditing                     */
  109.   floorArea,  /* The floor file                       */
  110.   holdArea,   /* Held messages (lost carrier)         */
  111.   tempArea,   /* all temporary files here             */
  112.   bioArea,    /* Biographies here                     */
  113.   bannerArea, /* all banner type files here           */
  114.   QwkWorkArea,/* Current working files: Qwk Mail(unused) */
  115.   QwkName,    /* Current Qwk Packet name              */
  116.   QwkLocation,/* Current Qwk Packet Town name         */
  117.   QwkFileArea;/* Current Qwk Files area               */
  118.   char sysBaud;   /* What's our baud rate going to be?    */
  119.   UNS_16  QwkMaxRooms; /* maximum number of rooms collectable in one packet*/
  120.   UNS_16  QwkMaxPacket;/* maximum number of messages in one packet */
  121.   UNS_16  netSize;    /* How many on the net?                 */
  122.   UNS_16  DomainHandlers; /* How many domains do we service?  */
  123.   UNS_16  MailHub;    /* Who's our mail hub?      */
  124.   UNS_16  MailHubGen;   /*          */
  125.   char    DomainDisplay[11];  /* customizable display of domain names */
  126.   UNS_16 EvNumber;
  127.   /*      stuff to distinguish the various Citadel programs               */
  128.   #define CITADEL         0       /* principal program                    */
  129.   #define xxxxx           1       /* unused                               */
  130.   #define NET             2       /* network downloader                   */
  131.   #define ARCHIVER        3       /* backup program       (future)        */
  132.   #define CONFIGUR        4
  133.   #define UTILITY         5
  134.   char    weAre;              /* set first thing by main()            */
  135.   UNS_16     paramVers;
  136.   /*                      Stuff to size system with:                      */
  137.   /* WARNING!!! if you expand MAXROOMS beyond 128, horrible, horrible     */
  138.   /* things will happen to the userlog entries, which will no longer      */
  139.   /* fit in the assigned 256-byte records and will overwrite things       */
  140.   /* with normally undesirable results. 82Nov10CrT                        */
  141.   UNS_16  MAXLOGTAB,  /* number of log entries supported      */
  142.   MailSlots,
  143.   MsgsPerrm,
  144.   MaxRooms,
  145.   SharedRooms;
  146.   /*              Stuff nowadays usually in bdscio.h:                     */
  147.   /* values for functions to return: */
  148.   #define TRUE            1
  149.   #define FALSE           0
  150.   #define ERROR          -1
  151.   #define SAMESTRING      0       /* value for strcmp() & friend          */
  152.   #define PTR_SIZE        (sizeof (char *))         /* could cause problems */
  153.   /*                      Stuff for rooms:                                */
  154.   #define LOBBY           0       /* Lobby> is >always< room 0.           */
  155.   #define MAILROOM        1       /* Mail>  is >always< room 1.           */
  156.   #define AIDEROOM        2       /* Aide> is >always< room 2.            */
  157.   #define MAXCODE       800
  158.   unsigned char codeBuf[MAXCODE];/* buffer for configuration routines */
  159.   unsigned char scratch[10];  /* scratch space for config routines    */
  160.   AN_UNSIGNED shave[8];       /* shave-and-a-haircut/2 bits pauses    */
  161.   UNS_16  catChar;    /* Location of next write in msg file   */
  162.   SECTOR_ID catSector;
  163.   UNS_16  AnonMailLength; /* anonymous mail max length    */
  164.   UNS_16  sizeLTentry;  /* contains size of a logTab entry      */
  165.   UNS_16  ConTimeOut;   /* seconds in CONSOLE mode before timeout */
  166.   char sysPassword[100];      /* Remote sysop                         */
  167.   char SysopArchive[40];  /* where to archive sysop mail    */
  168.   struct MiscBool BoolFlags;  /* Buncha flags                         */
  169.  
  170.   }
  171. CONFIG;            /* And that's all of the variables we want to save */
  172. /*
  173. *       Room data
  174. */
  175. #define MAXGEN    32       /* five bits of generation=>32 of them */
  176. #define FORGET_OFFSET (MAXGEN / 2)     /* For forgetting rooms  */
  177. #define RO_OFFSET ((MAXGEN / 2) + 4) /* For r/o room write priv */
  178. /* these define what knowRoom() return */
  179. #define UNKNOWN_ROOM  0 /* user does not know of room.    */
  180. #define KNOW_ROOM 1 /* user knows room.     */
  181. #define FORGOTTEN_ROOM  2 /* user has forgotten room.   */
  182. #define WRITE_PRIVS 3 /* user has write privs in r/o room */
  183. #define DEAD_ROOM 4 /* user is looking at dead room   */
  184. #define RO  1   /* temporary for some ifdefs */
  185. #define UN_STACK        40      /* stack of rooms */
  186. #define MSG_BULK        ( MSGSPERRM * sizeof (theMessages) )
  187. #define RB_SIZE         ( sizeof(roomBuf) - (PTR_SIZE * 1) )
  188. #define RB_TOTAL_SIZE   (RB_SIZE + MSG_BULK)
  189. struct rflags
  190.   {
  191.   /* Room flags                           */
  192.   BOOLEAN_FLAG(INUSE);        /* Room in use?                         */
  193.   BOOLEAN_FLAG(PUBLIC);       /* Room public?                         */
  194.   BOOLEAN_FLAG(ISDIR);        /* Room directory?                      */
  195.   BOOLEAN_FLAG(PERMROOM);     /* Room permanent?                      */
  196.   BOOLEAN_FLAG(SKIP);         /* Room skipped? (temporary for user)   */
  197.   BOOLEAN_FLAG(UPLOAD);       /* Can room be uploaded to?             */
  198.   BOOLEAN_FLAG(DOWNLOAD);     /* Can room be downloaded from?         */
  199.   BOOLEAN_FLAG(SHARED);       /* Is this a shared room?               */
  200.   BOOLEAN_FLAG(ARCHIVE);      /* Is this room archived somewhere?     */
  201.   BOOLEAN_FLAG(ANON);         /* All messages anonymous?              */
  202.   BOOLEAN_FLAG(NO_NET_DOWNLOAD); /* Accessible via the net for download? */
  203.   BOOLEAN_FLAG(INVITE);
  204.   BOOLEAN_FLAG(AUTO_NET);
  205.   BOOLEAN_FLAG(ALL_NET);
  206.   BOOLEAN_FLAG(READ_ONLY);   /* room is read-only */
  207.   BOOLEAN_FLAG(rflag9);
  208.   BOOLEAN_FLAG(rflag10);
  209.   BOOLEAN_FLAG(rflag11);
  210.   BOOLEAN_FLAG(rflag12);
  211.   BOOLEAN_FLAG(rflag13);
  212.   BOOLEAN_FLAG(rflag14);
  213.   BOOLEAN_FLAG(rflag15);
  214.   BOOLEAN_FLAG(rflag16);
  215.   BOOLEAN_FLAG(rflag17);
  216.  
  217.   };
  218. typedef struct
  219.   {
  220.   /* The summation of a room              */
  221.   AN_UNSIGNED   rtgen;        /* generation # of room                 */
  222.   struct rflags rtflags;      /* public/private flag etc              */
  223.   label         rtname;       /* name of room                         */
  224.   MSG_NUMBER    rtlastMessage;/* # of most recent message in room     */
  225.   MSG_NUMBER    rtlastNet;    /* Highest outgoing net message         */
  226.   char          rtShareType;  /* What type of sharing for this room?  */
  227.   int           rtFlIndex;    /* Index into the floors                */
  228.  
  229.   }
  230. rTable ;                      /* And see ROOMA.C for declaration      */
  231. typedef struct
  232.   {
  233.   MSG_NUMBER rbmsgNo;     /* every message gets unique#           */
  234.   SECTOR_ID rbmsgLoc;     /* sector message starts in             */
  235.  
  236.   }
  237. theMessages;
  238. typedef struct
  239.   {
  240.   /* The appearance of a room:            */
  241.   AN_UNSIGNED   rbgen;  /* generation # of room                 */
  242.   struct rflags rbflags;  /* same bits as flags above             */
  243.   label         rbname; /* name of room                         */
  244.   ROOM_AREA     rbArea; /* area this room is attached to        */
  245.   char          rbShareType;  /* room share type                      */
  246.   UNS_16        rbFlIndex;  /* index into the floors                */
  247.   theMessages *msg;
  248.  
  249.   }
  250. aRoom ;
  251. /*
  252. *       userlog stuff
  253. */
  254. #define CRYPTADD        117    /*                                      */
  255. #define LB_SIZE         ( sizeof (logBuf) - (PTR_SIZE * 2) )
  256. #define MAIL_BULK       ( MAILSLOTS * sizeof (theMessages) )
  257. #define GEN_BULK        ( MAXROOMS * sizeof (AN_UNSIGNED) )
  258. #define LB_TOTAL_SIZE   ( LB_SIZE + MAIL_BULK + GEN_BULK )
  259. struct lflags
  260.   {
  261.   /* Flags for person in log              */
  262.   BOOLEAN_FLAG(FLOORS);       /* Unused for now                       */
  263.   BOOLEAN_FLAG(LFMASK);       /* Linefeeds?                           */
  264.   BOOLEAN_FLAG(EXPERT);       /* Expert?                              */
  265.   BOOLEAN_FLAG(AIDE);         /* Vice-Grand-Poobah?                   */
  266.   BOOLEAN_FLAG(L_INUSE);      /* Is this slot in use?                 */
  267.   BOOLEAN_FLAG(TIME);         /* Send time to user of msg creation?   */
  268.   BOOLEAN_FLAG(OLDTOO);       /* Print out last oldmessage on <N>ew?  */
  269.   BOOLEAN_FLAG(NET_PRIVS);    /* User have net privileges?            */
  270.   BOOLEAN_FLAG(RUGGIE);       /* Juvenile? Future fun-ness maybe      */
  271.   BOOLEAN_FLAG(HALF_DUP);     /* half duplex?                   */
  272.   BOOLEAN_FLAG(TWIT);         /* twit?                          */
  273.   BOOLEAN_FLAG(DOOR_PRIVS);   /* door privies?                  */
  274.   BOOLEAN_FLAG(PERMANENT);    /* permanent account?             */
  275.   BOOLEAN_FLAG(DL_PRIVS);     /* sigh                           */
  276.   BOOLEAN_FLAG(ALT_RE);       /* alternative (old-style) .RE    */
  277.   BOOLEAN_FLAG(NoPrompt);     /* message entry prompt           */
  278.   BOOLEAN_FLAG(ANSI);         /* Flag: Ansii enabled:1          */
  279.   BOOLEAN_FLAG(MSG_PAUSE);    /* Flag: Pause between msgs:1     */
  280.   BOOLEAN_FLAG(lflag5);
  281.   BOOLEAN_FLAG(lflag6);
  282.   BOOLEAN_FLAG(lflag7);
  283.   BOOLEAN_FLAG(lflag8);
  284.   BOOLEAN_FLAG(lflag9);
  285.  
  286.   };
  287. #define MAXVISIT        8       /* #visits we remember old newestLo for */
  288. #define GENSHIFT        3       /* Where the generation # is            */
  289. #define CALLMASK        7       /* For finding last visit               */
  290. typedef struct
  291.   {
  292.   /* The appearance of a user:            */
  293.   AN_UNSIGNED   lbnulls;      /* #nulls, lCase, lFeeds                */
  294.   struct lflags lbflags;      /* LFMASK, EXPERT, AIDE, INUSE, etc.    */
  295.   AN_UNSIGNED   lbwidth;      /* terminal width                       */
  296.   int           credit;       /* Credit for long distance calls       */
  297.   label         lbname;       /* caller's name                        */
  298.   label         lbpw;         /* caller's password                    */
  299.   MSG_NUMBER    lbvisit[MAXVISIT];/* newestLo for this and 7 prev. visits */
  300.   long          lblaston;     /* seconds since arbitrary date         */
  301.   AN_UNSIGNED   lbdelay;  /* milliseconds delay     */
  302.   AN_UNSIGNED   *lbgen;/* 5 bits gen, 3 bits lastvisit       */
  303.   theMessages *lbMail;
  304.  
  305.   }
  306. logBuffer ;
  307. typedef struct
  308.   {
  309.   /* Summation of a person:               */
  310.   UNS_16   ltpwhash;    /* hash of password                     */
  311.   UNS_16   ltnmhash;    /* hash of name                         */
  312.   UNS_16   ltlogSlot;   /* location in userlog.buf              */
  313.   MSG_NUMBER ltnewest;        /* last message on last call            */
  314.   char  ltpermanent;    /* permanent account?     */
  315.  
  316.   }
  317. LogTable ;                    /* And see LOG.C for declaration        */
  318. /* this is a mail forwarding structure.  Managed by slist, on   */
  319. /* disk it's known as ctdlfwd.sys.  */
  320. typedef struct
  321.   {
  322.   char *UserName;
  323.   char *System;
  324.   char *Alias;
  325.  
  326.   }
  327. ForwardMail;
  328. /*
  329. *     terminal stuff
  330. */
  331. #define SPECIAL         27      /* <ESC>        console escape char     */
  332. #define CON_NEXT        20      /* ^T           console request char    */
  333. typedef struct
  334.   {
  335.   char *unambig;              /* name of the file */
  336.   char FileDate[8];           /* yymmmdd<0>   */
  337.   long FileSize;              /* size of file */
  338.  
  339.   }
  340. DirEntry;
  341. /*
  342. *   List handling structures - specific.
  343. *   See SLIST.C for generic handling functionality
  344. */
  345. /*
  346. * This structure is used to implement the archival lists.  Each element of
  347. * this sort of list contains two things:
  348. * o The number of the room it is associated with.  There should never be more
  349. *   than one instance of this number in the list.  We should probably attempt
  350. *   to cull out duplicates.  This will be dependent on the behavior of the
  351. *   old LIBARCH code.
  352. * o The name of the file to archive to.
  353. */
  354. typedef struct
  355.   {
  356.   UNS_16 num;
  357.   UNS_16 num2;
  358.   char *string;
  359.  
  360.   }
  361. NumToString;
  362. #define CC_SIZE         140
  363. #define HasCC(x)        ((x)->mbCC.start != NULL)
  364. #define HasOverrides(x) ((x)->mbOverride.start != NULL)
  365. #define SCREEN          0
  366. #define MSGBASE         1
  367. #define TEXTFILE        2
  368. /* this is useful in events and other places */
  369. typedef struct
  370.   {
  371.   UNS_16 first;
  372.   long second;
  373.  
  374.   }
  375. TwoNumbers;
  376. /*
  377. *     message stuff
  378. */
  379. #define MAXTEXT         7500    /* maximum chars in edit buffer         */
  380. #define MAXWORD         256     /* maximum length of a word             */
  381. #define IDIOT_TRIGGER   8       /* Idiot trigger                        */
  382. #define HELD 3
  383. /* output identifications */
  384. #define WHATEVER  0 /* Everything except what we list after */
  385. #define MSGS    1 /* Msg output       */
  386. #define DL_MSGS   2 /* Download messages      */
  387. #define STATIC_MSG_SIZE (sizeof msgBuf - (sizeof msgBuf.mbCC + sizeof msgBuf.mbOverride + sizeof msgBuf.mbtext + sizeof msgBuf.mbInternal + sizeof msgBuf.mbForeign))
  388. #define MoveMsgBuffer(x, y)     memcpy(x, y,(long)(sizeof *x) - PTR_SIZE),(y)->mbForeign.start = (y)->mbCC.start = (y)->mbOverride.start = NULL,strCpy((x)->mbtext, (y)->mbtext);
  389. #define O_NET_PATH_SIZE         100
  390. typedef struct
  391.   {
  392.   /* This is what a msg looks like        */
  393.   int  mbheadChar       ;     /* start of message                     */
  394.   SECTOR_ID     mbheadSector; /* start of message                     */
  395.   char  mbauth[129];    /* name of author                       */
  396.   label mbdate ;    /* creation date                        */
  397.   label mbtime ;    /* creation time                        */
  398.   label mbId   ;    /* local number of message              */
  399.   label mboname;    /* short human name for origin system   */
  400.   label mborig ;    /* US xxx xxx xxxx style ID             */
  401.   label mbroom ;    /* creation room                        */
  402.   label mbsrcId;    /* message ID on system of origin       */
  403.   char  mbto[129];    /* private message to                   */
  404.   char  mbaddr[(NAMESIZE * 2) + 10];/* address of system for net routing    */
  405.   char  mbOther[O_NET_PATH_SIZE];/* OtherNet address                  */
  406.   label mbreply;    /* reply pointer -- Mail only   */
  407.   label mbdomain;   /* home domain of message   */
  408.   SListBase mbCC;   /* lists of CC type people              */
  409.   SListBase mbOverride; /* for overriding the mbto field        */
  410.   SListBase mbInternal; /* for overriding the mbto field        */
  411.   SListBase mbForeign;  /* list of foreign fields   */
  412.   char  *mbtext;    /* buffer text is edited in             */
  413.  
  414.   }
  415. MessageBuffer;
  416. /* values for showMess routine */
  417. #define NEWoNLY         0
  418. #define OLDaNDnEW       1
  419. #define OLDoNLY         2
  420. #define GLOBALnEW       3
  421. #define PHRASE_SIZE     50
  422. typedef struct
  423.   {
  424.   SListBase Users;
  425.   /* char  System[(2 * NAMESIZE) + 10]; */
  426.   char  Phrase[PHRASE_SIZE];
  427.   long  Date;
  428.   char  LocalOnly;
  429.  
  430.   }
  431. OptValues;
  432. /* definitions for determination of net message display */
  433. #define ALL_MESSAGES    0
  434. #define LOCAL_ONLY      1
  435. struct mBuf
  436.   {
  437.   DATA_BLOCK    sectBuf;
  438.   int           thisChar;
  439.   SECTOR_ID     thisSector;
  440.   int           oldChar;
  441.   SECTOR_ID     oldSector;
  442.  
  443.   };
  444. typedef struct
  445.   {
  446.   MSG_NUMBER ltnewest;        /* last message on last call            */
  447.   SECTOR_ID  loc;
  448.  
  449.   }
  450. CheckPoint;
  451. #define CHECKPT   "chkpt"
  452. /*
  453. *     modem stuff
  454. */
  455. #define NEWCARRIER   0x01       /* returned to main prog on login       */
  456. #define CPT_SIGNAL      18      /* ^R                                   */
  457. #define MODEM           0       /* current user of system is            */
  458. #define CONSOLE         1       /* one of these                         */
  459. /*  output XON/XOFF etc flag... */
  460. #define OUTOK           0       /* normal output                        */
  461. #define OUTPAUSE        1       /* a pause has been requested           */
  462. #define OUTNEXT         2       /* quit this message, get the next      */
  463. #define OUTSKIP         3       /* stop current process                 */
  464. #define OUTPARAGRAPH    4       /* skip to next paragraph               */
  465. #define IMPERVIOUS      5       /* make current output unstoppable      */
  466. #define NET_CALL        6       /* net call detected - only banner      */
  467. #define STROLL_DETECTED 7       /* net call detected - only banner      */
  468. #define NEITHER         0       /* don't echo input at all              */
  469. #define CALLER          1       /* echo to caller only --passwords etc  */
  470. #define BOTH            2       /* echo to caller and console both      */
  471. /* These are bit flags passed to string input functions */
  472. #define NO_ECHO         0x01  /* Echo input as X's                    */
  473. #define BS_VALID  0x02  /* return BS_RETURN on BS at zero */
  474. #define QUEST_SPECIAL 0x04  /* question mark is special?    */
  475. #define CR_ON_ABORT 0x08  /* question mark is special?    */
  476. #define TWICE   2 /* for MenuList() - icky kludge   */
  477. /* this is for command acquisition intelligence */
  478. #define TERM  "\001"
  479. #define NTERM "\002"
  480. /* return values for command acquisition */
  481. #define BACKED_OUT  0
  482. #define BAD_SELECT  1
  483. #define GOOD_SELECT 2
  484. /* message manipulation values */
  485. #define NO_CHANGE 0
  486. #define DELETED   1
  487. #define NETTED    2
  488. /* Result code defines, to be returned by system dependent functions */
  489. #define R_300           0
  490. #define R_1200          1
  491. #define R_2400          2
  492. #define R_4800          3
  493. #define R_9600          4
  494. #define R_14400         5
  495. #define R_19200         6
  496. #define R_38400         7
  497. #define R_57600         8
  498. #define R_RING          9
  499. #define R_DIAL         10
  500. #define R_NODIAL       11
  501. #define R_AOK          12
  502. #define R_NOCARR       13
  503. #define R_BUSY         14
  504. /*
  505. *     event stuff
  506. */
  507. #define SUNDAYS         1
  508. #define MONDAYS         2
  509. #define TUESDAYS        4
  510. #define WEDNESDAYS      8
  511. #define THURSDAYS       16
  512. #define FRIDAYS         32
  513. #define SATURDAYS       64
  514. #define ALL_DAYS        127     /* 0x7F */
  515. /* event types */
  516. #define TYPREEMPT       0
  517. #define TYNON           1
  518. #define TYQUIET         2
  519. /* event classes */
  520. #define CLNET           0
  521. #define CLEXTERN        1
  522. #define CLREL           2
  523. #define CL_DL_TIME      3
  524. #define CL_ANYTIME_NET  4
  525. #define CL_DOOR_TIME    5
  526. #define CL_AUTODOOR     6
  527. #define CL_CHAT_ON  7
  528. #define CL_CHAT_OFF 8
  529. #define CL_REDIRECT 9
  530. #define CL_NEWUSERS_ALLOWED 10
  531. #define CL_NEWUSERS_DISALLOWED  11
  532. #define CL_UNTIL_NET  12
  533. #define CL_NETCACHE 13
  534. /* number of event classes supported */
  535. #define EVENT_CLASS_COUNT 14
  536. #define ALL_NETS        ~(0l)
  537. #define MAX_NET         32
  538. #define NO_NETS         0l
  539. #define PRIORITY_MAIL (1l << 31)
  540. typedef struct
  541.   {
  542.   int            EvDur,               /* Event duration       */
  543.   EvWarn;              /* Event warning pointer*/
  544.   unsigned char  EvClass,             /* Event Class          */
  545.   EvType;              /* Event Type           */
  546.   MULTI_NET_DATA EvExitVal;           /* Event Exit value     */
  547.   UNS_16         EvMinutes;           /* From midnight        */
  548.   union
  549.     {
  550.     struct
  551.       {
  552.       long       EvDeadTime;      /* Anytime netting      */
  553.       int        EvAnyDur;        /* Anytime netting      */
  554.  
  555.       }
  556.     Anytime;
  557.     label      EvUserName;          /* Autodoor target acct */
  558.     struct
  559.       {
  560.       /* Redirect incoming  */
  561.       label EvSystem;   /* Valid system   */
  562.       char  EvFilename[MAX_FILENAME]; /* incoming file */
  563.       int   EvHomeDir;    /* points into codeBuf  */
  564.  
  565.       }
  566.     Redirect;
  567.  
  568.     }
  569.   vars;
  570.  
  571.   }
  572. EVENT;
  573. /*
  574. * net stuff
  575. */
  576. /* SYSBAUD constants    */
  577. #define ONLY_300        0       /* 300 baud only                        */
  578. #define BOTH_300_1200   1       /* +1200 baud                           */
  579. #define TH_3_12_24      2       /* +2400 baud                           */
  580. #define B_4             3       /* +4800 baud                           */
  581. #define B_5             4       /* +9600 baud                           */
  582. #define B_6             5       /* 14400 baud                           */
  583. #define B_7             6       /* 19200 baud                           */
  584. #define B_8             7       /* 38400 baud                           */
  585. #define B_9             8       /* 57600 baud                           */
  586. /* ITL constants        */
  587. #define ITL_SUCCESS     0
  588. #define ITL_BAD_TRANS   1
  589. #define ITL_NO_OPEN     2
  590. /* Network request codes        */
  591. #define HANGUP          0       /* Terminate networking                 */
  592. #define NORMAL_MAIL     1       /* Send normal Mail                     */
  593. #define R_FILE_REQ      2       /* Request a single file                */
  594. #define A_FILE_REQ      3       /* Request a number of files            */
  595. #define NET_ROOM        5       /* Send a shared room                   */
  596. #define CHECK_MAIL      6       /* Check for recipient validity         */
  597. #define SEND_FILE       7       /* Send a file to another system        */
  598. #define NET_ROUTE_ROOM  8       /* Send a routed shared room            */
  599. #define ROUTE_MAIL      9       /* Send route mail                      */
  600. #define ITL_COMPACT 10  /* Compact messages during transfer */
  601. #define FAST_MSGS 21  /* Mass transfer      */
  602. #define ITL_PROTOCOL    100     /* Switch to different protocol         */
  603. #define ROLE_REVERSAL   201     /* Reverse roles                        */
  604. #define SYS_NET_PWD     202     /* System password stuff                */
  605. #define BAD             0       /* Reply Codes: this indicates bad      */
  606. #define GOOD            1       /* And this indicates good              */
  607. /* These refer to negative ack mail     */
  608. #define NO_ERROR        0       /* No error (ends transmission)         */
  609. #define NO_RECIPIENT    1       /* No recipient found                   */
  610. #define BAD_FORM        2       /* Something's wrong                    */
  611. #define UNKNOWN         99      /* Something's REALLY wrong (eek!)      */
  612. #define PEON            0
  613. #define REG_HOST        1
  614. #define BACKBONE        2       /* Kinda like a hub     */
  615. #define PASS_BACKBONE   3       /* Used in "mode" only, not rbSharedType */
  616. #define ACTIVE_BACKBONE 4
  617. /* These used with ITL_PROTOCOL command         */
  618. #define XM_ITL          "0"
  619. #define YM_ITL          "1"
  620. #define WXM_ITL         "2"
  621. /* These are used with ITL_COMPACT command  */
  622. #define COMPACT_1 "0"
  623. #define NET_GEN         32
  624. #define NON_NET   0
  625. #define NORMAL_NET  1
  626. #define ANYTIME_NET 2
  627. #define ANY_CALL  3
  628. #define STROLL_CALL 4       /* net call detected - only banner      */
  629. #define UNTIL_NET 5
  630. #define NET_CACHE 6
  631. #define NOT_SYSTEM      0
  632. #define BAD_FORMAT      1
  633. #define NO_SYSTEM       2
  634. #define IS_SYSTEM       3
  635. #define SYSTEM_IS_US  4
  636. /* domain function responses  */
  637. #define REFUSE    0
  638. #define OURS    1
  639. #define LOCALROUTE  2
  640. #define DOMAINFILE  3
  641. /* domain file upload results */
  642. #define DOMAIN_SUCCESS  0
  643. #define DOMAIN_FAILURE  1
  644. /* route mail send errors */
  645. #define NO_SUCH_FILE  0
  646. #define REFUSED_ROUTE 1
  647. #define GOOD_SEND 2
  648. #define UNKNOWN_ERROR 3
  649. /* netController() flag values -- OR these values together */
  650. #define REPORT_FAILURE  0x01
  651. #define LEISURELY 0x02
  652. /*
  653. * this structure is the flags attached to a node
  654. */
  655. struct nflags
  656.   {
  657.   /* Any and all reasons to call this node*/
  658.   BOOLEAN_FLAG(normal_mail);  /* Outgoing normal mail?                */
  659.   BOOLEAN_FLAG(in_use);       /* Is this record even in use?          */
  660.   BOOLEAN_FLAG(room_files);   /* Any file requests?                   */
  661.   BOOLEAN_FLAG(local);        /* Is this node local?                  */
  662.   BOOLEAN_FLAG(spine);        /* Will we be a spine?                  */
  663.   BOOLEAN_FLAG(send_files);
  664.   BOOLEAN_FLAG(is_spine);     /* Is that system a spine?              */
  665.   BOOLEAN_FLAG(OtherNet);
  666.   BOOLEAN_FLAG(HasRouted);
  667.   BOOLEAN_FLAG(RouteFor);
  668.   BOOLEAN_FLAG(RouteTo);
  669.   BOOLEAN_FLAG(Stadel);
  670.   BOOLEAN_FLAG(RouteLock);
  671.   BOOLEAN_FLAG(ExternalDialer);
  672.   BOOLEAN_FLAG(NoDL);
  673.   BOOLEAN_FLAG(MassTransfer);
  674.   BOOLEAN_FLAG(Zip);             /* Amiga update */
  675.   BOOLEAN_FLAG(Zoo);
  676.   BOOLEAN_FLAG(Arc);
  677.   BOOLEAN_FLAG(Lha);
  678.  
  679.   };
  680. #define CGetMode(x)  ((x) & 7)
  681. #define CSetMode(x, y) x = (x & (~7)) + y;
  682. #define GetFA(x)  ((x) & 8)
  683. #define SetFA(x)  x |= 8;
  684. #define UnSetFA(x)  x &= (~8);
  685. #define CACHE_END_NAME    "%d.msg"
  686. #define V_CACHE_END_NAME  "v%d.msg"
  687. #define RECOVERY_FILE "incase.net"
  688. #define FAST_TRANS_FILE "\001\002\003"
  689. typedef struct
  690.   {
  691.   char        *addr1, *addr2, *addr3;
  692.   MSG_NUMBER  HiSent;
  693.   int (*sendfunc)(int x);
  694.  
  695.   }
  696. NetInfo;
  697. typedef struct
  698.   {
  699.   MSG_NUMBER lastMess;        /* Highest net message in this room     */
  700.   unsigned   srgen;           /* High bit of gen is used flag         */
  701.   unsigned   srslot;
  702.   int        mode;    /* low 3 bits is mode, fourth bit tells */
  703.   /* if there's a file of msgs to send  */
  704.  
  705.   }
  706. SharedRoom;
  707. #define NT_SIZE         (sizeof (*netTab) - (PTR_SIZE))
  708. #define NB_SIZE         (sizeof (netBuf)  - (PTR_SIZE))
  709. #define SR_BULK         (SHARED_ROOMS * sizeof (SharedRoom))
  710. #define NT_TOTAL_SIZE   (NT_SIZE + SR_BULK)
  711. #define NB_TOTAL_SIZE   (NB_SIZE + SR_BULK)
  712. typedef struct
  713.   {
  714.   label          netId;       /* Node id      */
  715.   label          netName;     /* Node name    */
  716.   char           nbShort[3];  /* short hand */
  717.   label          OurPwd;
  718.   label          TheirPwd;
  719.   MULTI_NET_DATA MemberNets;
  720.   struct nflags  nbflags;     /* Flags        */
  721.   char           baudCode;    /* Baud code for this node   */
  722.   char           nbGen;       /* Generation value for this node */
  723.   char           access[40];  /* For alternative access       */
  724.   int      nbRoute;     /* what system do we route via? */
  725.   UNS_16     nbRouteGen;     /* what system do we route via? */
  726.   UNS_16     nbHiRouteInd;        /* internal housekeeping        */
  727.   unsigned long  nbLastConnect; /* last connection with this system */
  728.   SharedRoom *netRooms;
  729.  
  730.   }
  731. NetBuffer;
  732. typedef struct
  733.   {
  734.   int            ntnmhash;
  735.   int            ntidhash;
  736.   char           ntShort[3];
  737.   struct nflags  ntflags ;
  738.   MULTI_NET_DATA ntMemberNets;
  739.   char           ntGen;
  740.   SharedRoom     *netTRooms;
  741.  
  742.   }
  743. NetTable;
  744. struct cmd_data
  745.   {
  746.   /* Commands for networking              */
  747.   AN_UNSIGNED command;
  748.   char        fields[4][NAMESIZE];
  749.  
  750.   };
  751. struct netMLstruct
  752.   {
  753.   MSG_NUMBER ML_id;
  754.   SECTOR_ID  ML_loc;
  755.  
  756.   };
  757. struct fl_req
  758.   {
  759.   label room;
  760.   label roomfile;
  761.   NET_AREA flArea;
  762.   label filename;
  763.  
  764.   };
  765. struct fl_send
  766.   {
  767.   NET_AREA snArea;
  768.   label sFilename;
  769.  
  770.   };
  771. /*
  772. * Error values for reasons on not sharing
  773. */
  774. #define NO_ROOM   0
  775. #define NOT_SHARING 1 /* not a shared room */
  776. #define NOT_SHARED  2 /* not sharing with you */
  777. #define NO_PWD    3
  778. #define FOUND   4
  779. typedef struct
  780.   {
  781.   label Room;   /* this is the target */
  782.   char  virtual;  /* the rest contains results */
  783.   int   room;
  784.   int   index;
  785.   char  reason;
  786.  
  787.   }
  788. RoomSearch;
  789. /*
  790. *     Floor data structures
  791. */
  792. /* Display modes for floor summaries    */
  793. #define INT_EXPERT      0       /* First display for experts            */
  794. #define INT_NOVICE      1       /* First display for novices            */
  795. #define ONLY_FLOORS     2       /* Floors only, no rooms 'tall.         */
  796. #define NOT_INTRO       3       /* 'K' is done.                         */
  797. #define FORGOTTEN       4       /* Forgotten rooms list                 */
  798. #define MATCH_SEL       10
  799. #define DR_SEL          11
  800. #define SH_SEL          12
  801. #define PR_SEL          13
  802. #define ANON_SEL        14
  803. #define READONLY        15
  804. struct floor
  805.   {
  806.   label FlName;
  807.   char  FlInuse;
  808.   label FlModerator;
  809.  
  810.   };
  811. /*
  812. *     Exit values for errorlevels
  813. */
  814. #define SYSOP_EXIT              0        /* "Normal"     */
  815. #define RECURSE_EXIT            1
  816. #define CRASH_EXIT              2
  817. #define REMOTE_SYSOP_EXIT       3
  818. #define DOOR_EXIT               4
  819. /*
  820. *     Useful psuedo functions
  821. */
  822. #define onLine()        (haveCarrier    ||   onConsole)
  823. #define wrNetId(x)      ((strCmpU(x, ALL_LOCALS) != 0) ? x : WRITE_LOCALS)
  824. #define putMLNet(f,b)   if (fwrite(&b, sizeof(b), 1, f) != 1)\
  825. crashout("putMLNet crash")
  826. #define getMLNet(f,b)   (fread(&b, sizeof(b), 1, f) == 1)
  827. #define putSLNet(b, f)  if (fwrite(&b, sizeof(b), 1, f) != 1)\
  828. crashout("putSLNet crash")
  829. #define getSLNet(b, f)  (fread(&b, sizeof(b), 1, f) == 1)
  830. #define TheSysop()      (aide && strCmpU(cfg.SysopName, logBuf.lbname) == SAMESTRING && onConsole)
  831. #define SomeSysop()     (TheSysop() || (remoteSysop && strCmpU(cfg.SysopName, logBuf.lbname) == SAMESTRING))
  832. #define HalfSysop()     (aide && (remoteSysop || onConsole))
  833. #define setNeedsProcessing(i)   netBuf.netRooms[i].srslot |= 0x8000
  834. #define chkNeedsProcessing(i)   (netBuf.netRooms[i].srslot & 0x8000)
  835. #define resetNeedsProcessing(i) netBuf.netRooms[i].srslot &= 0x7FFF
  836. #define isSharedRoom(h, i)      (netTab[h].netTRooms[i].srgen & 0x8000)
  837. #define resetNetRoomFlag(i)     netBuf.netRooms[i].srgen &= 0x7FFF;\
  838. netTab[thisNet].netTRooms[(i)].srgen &= 0x7FFF;
  839. #define netRoomSlot(i)          (netBuf.netRooms[i].srslot & 0x7FFF)
  840. #define netTabRoomSlot(h, i)    (netTab[h].netTRooms[i].srslot & 0x7FFF)
  841. #define netGen(h, i)            (netTab[h].netTRooms[i].srgen & 0x7FFF)
  842. #define roomValidate(h, i)  (roomTab[netTabRoomSlot(h, i)].rtgen==netGen(h,i) \
  843. && roomTab[netTabRoomSlot(h, i)].rtflags.INUSE \
  844. && roomTab[netTabRoomSlot(h, i)].rtflags.SHARED)
  845. #define INTERVALS 8             /* Half second intervals                */
  846. #define minimum(x,y)    ((x) < (y) ? (x) : (y))
  847. /* #define max(x,y)        ((x) > (y) ? (x) : (y)) */
  848. #define initLogBuf(x)   (x)->lbgen = (AN_UNSIGNED *) GetDynamic(GEN_BULK),\
  849.                         (x)->lbMail = (theMessages *)GetDynamic(MAIL_BULK)
  850. #define killLogBuf(x)   free((x)->lbgen), free((x)->lbMail)
  851.  
  852. #define initRoomBuf(x)  (x)->msg = (theMessages *)GetDynamic(max(MAIL_BULK, MSG_BULK))
  853.  
  854. #define killRoomBuf(x)  free((x)->msg)
  855. #define initNetBuf(x)   (x)->netRooms = (SharedRoom *)GetDynamic(sizeof (*(x)->netRooms) * SHARED_ROOMS)
  856. #define killNetBuf(x)   free((x)->netRooms)
  857. #define NumElems(x)     (sizeof (x)) / (sizeof (x[0]))
  858. #define copyLogBuf(x, y)  memcpy(y, x, LB_SIZE),\
  859.                           memcpy((y)->lbMail, (x)->lbMail, (long)MAIL_BULK),\
  860.                           memcpy((y)->lbgen, (x)->lbgen, (long)GEN_BULK)
  861. #define HasPriorityMail(n)  (netTab[n].ntMemberNets & PRIORITY_MAIL)
  862. extern int ClassActive[];
  863. #define Dl_Limit_On()   (ClassActive[CL_DL_TIME])
  864. #define Door_Limit_On() (ClassActive[CL_DOOR_TIME])
  865. extern char **ValidMenuOpts, *Menu;
  866. #define RegisterThisMenu(x, y)      Menu = x, ValidMenuOpts = y;
  867. #define NodeDisabled(x) (!(netTab[x].ntMemberNets & ALL_NETS))
  868. #define CompExtension(CompType)    Formats[(CompType) - 1].Format
  869. /*
  870. *     Call log stuff
  871. */
  872. #define BAUD            0       /* This message concerns baud rate      */
  873. #define L_IN            1       /*  "      "       "     login          */
  874. #define L_OUT           2       /*  "      "       "     logout         */
  875. #define CARRLOSS        3       /*  "      "       "     carr-loss      */
  876. #define FIRST_IN        4       /*  "      "       "     init           */
  877. #define LAST_OUT        5       /*  "      "       "     close-down     */
  878. #define EVIL_SIGNAL     6       /*  "      "       "     user errors    */
  879. #define CRASH_OUT       7       /*  "      "       "     crash down     */
  880. #define INTO_NET        8       /*  "      "       "     net entry      */
  881. #define OUTOF_NET       9       /*  "      "       "     net exit       */
  882. #define DOOR_RETURN     10      /*  "      "       "     door returns   */
  883. #define DOOR_OUT        11      /*  "      "       "     door exits     */
  884. #define BADWORDS_SIGNAL 12      /*  "      "       "     bad words      */
  885. #define TRIED_CHAT      13      /*  "      "       "     chat attempts  */
  886. #define FL_START        0       /* starting a file transfer             */
  887. #define FL_FAIL         1       /* file transfer failed                 */
  888. #define FL_SUCCESS      2       /* file transfer success                */
  889. #define FL_EX_END       3       /* external file transfer finish        */
  890. /*
  891. *     Transfer protocol constants
  892. */
  893. #define ASCII           0
  894. #define XMDM            1
  895. #define YMDM            2
  896. #define WXMDM           3
  897. #define TOP_PROTOCOL  WXMDM
  898. #define InternalProtocol(x) (x >= 0 && x <= TOP_PROTOCOL)
  899. #define MAX_WX_ERRORS   10
  900. #define ERRORMAX        10       /* How many errors to suffer through   */
  901. #define RETRYMAX        10
  902. #define MINUTE          60       /* How long is a minute?               */
  903. #define STARTUP         1        /* Code to start a transfer            */
  904. #define FINISH          2        /* Code to cleanup a transfer          */
  905. /* Reception startup error values */
  906. #define TRAN_SUCCESS    0       /* Successful transfer                  */
  907. #define NO_LUCK         1       /* Never return this to caller          */
  908. #define CANCEL          2       /* Session encountered a CAN            */
  909. #define NO_START        3       /* Transfer never even started!         */
  910. #define TRAN_FAILURE    4       /* Something blew...                    */
  911. /* Internally used values, not returned to caller       */
  912. #define NO_ERROR        0
  913. #define BAD_DLE         1
  914. #define EARLY_SYN       2
  915. #define DATA_TIMEOUT    3
  916. #define BAD_CRC         4
  917. #define BAD_CKSM        5
  918. #define BAD_SEC_COMP    6
  919. #define SYNCH_ERROR     7       /* Fatal */
  920. #define WRITE_ERROR     8       /* Fatal */
  921. #define CARR_LOSS       9       /* Fatal */
  922. /* Internal WXMODEM enumerations for transmission window */
  923. #define NOT_USED        0
  924. #define SECTOR_READY    1
  925. #define SENT            2
  926. #define ACKED           3
  927. /* ASCII characters: */
  928. #define SOH             1
  929. #define STX             2
  930. #define CNTRLC          3
  931. #define CNTRLD          4      /* control D character */
  932. #define EOT             4
  933. #define ETX   3
  934. #define ACK             6
  935. #define BELL            7
  936. #define BACKSPACE       8
  937. #define CNTRLI          9       /* aka tab                              */
  938. #define TAB             9       /* aka ^I                               */
  939. #define NEWLINE        10       /* "linefeed" to philistines.           */
  940. #define CNTRLl         12       /* Sysop privileges                     */
  941. #define CNTRLO         15
  942. #define DLE            16
  943. #define XON            17
  944. #define XOFF           19       /* control-s                            */
  945. #define NAK            21
  946. #define SYN            22
  947. #define CAN            24
  948. #define CNTRLZ         26
  949. #define CPMEOF     CNTRLZ
  950. #define ESC            27       /* altmode                              */
  951. #define CRC_START     'C'       /* CRC Mode for WC                      */
  952. #define DEL          0x7F       /* delete char                          */
  953. #define IS_NUMEROUS     0x01
  954. #define IS_DL           0x02
  955. #define NEEDS_FIN       0x04
  956. #define RIGAMAROLE      0x08
  957. #define NOT_AVAILABLE   0x10
  958. #define NEEDS_HDR       0x20    /* True only for file transfer          */
  959. typedef struct
  960.   {
  961.   char *GenericName;
  962.   UNS_16  KludgeFactor;
  963.   UNS_16  flags;                 /* Bit map - see above */
  964.   char *name;
  965.   char *MsgTran;
  966.   char *BlbName;
  967.   char *UpBlbName;
  968.   int  (*method)(int c);
  969.   UNS_16 BlockSize;
  970.   int  (*SendHdr)(long fileSize, char *fileName);
  971.   int  (*CleanUp)(void);
  972.  
  973.   }
  974. PROTO_TABLE;
  975. typedef struct
  976.   {
  977.   UNS_16 ThisBlock;      /* Block # of this block */
  978.   AN_UNSIGNED *buf;
  979.   CRC_TYPE ThisCRC;        /* So we only calculate once */
  980.   char status;        /* Init these to NOT_USED */
  981.  
  982.   }
  983. TransferBlock;
  984. #define NORMAL          0
  985. #define DISK            1
  986. /*
  987. * Compression types for use in netting
  988. */
  989. #define NO_COMP   -1
  990. #define LHA_COMP  1
  991. #define ZIP_COMP  2
  992. #define ZOO_COMP  3
  993. #define ARC_COMP  4
  994. #define COMP_MAX  ARC_COMP
  995. /*
  996. * Protocols for Mass Transfers
  997. */
  998. #define DEFAULT_PROTOCOL  -1
  999. #define XM_PROTOCOL   0
  1000. #define YM_PROTOCOL   1
  1001. #define WX_PROTOCOL   2
  1002. #define ZM_PROTOCOL   3
  1003. /*
  1004. * Table for decoding funny files
  1005. */
  1006. typedef struct
  1007.   {
  1008.   char *Format;
  1009.   char Many;
  1010.   char (*Func)(FILE *fd, ...);
  1011.  
  1012.   }
  1013. FunnyInfo;
  1014. extern FunnyInfo Formats[];
  1015. /*
  1016. *     SEA ARC reading structure
  1017. */
  1018. typedef struct
  1019.   {
  1020.   char   ArchiveMark;
  1021.   char   Header;
  1022.   char name [13];     /* file name */
  1023.   UNS_32 size;        /* size of compressed file */
  1024.   UNS_16 date;        /* file date*/
  1025.   UNS_16 time;        /* file time */
  1026.   UNS_16 crc;         /* cyclic redundancy check */
  1027.   UNS_32 length;      /* true file length */
  1028.  
  1029.   }
  1030. ARCbuf;
  1031. /*
  1032. *     PK ZIP header structure
  1033. */
  1034. typedef struct
  1035.   {
  1036.   UNS_32 Signature;
  1037.   UNS_16 ExtVersion;
  1038.   UNS_16 BitFlags;
  1039.   UNS_16 Method;
  1040.   UNS_16 FileTime;
  1041.   UNS_16 FileDate;
  1042.   UNS_32 CRC;
  1043.   UNS_32 CompSize;
  1044.   UNS_32 NormalSize;
  1045.   UNS_16 NameLength;
  1046.   UNS_16 FieldLength;
  1047.  
  1048.   }
  1049. ZipHeader;
  1050. /*
  1051. *     ZOO header information
  1052. * These structures were taken directly from Rahul Dhesi's code
  1053. * and are under his copyright.
  1054. */
  1055. #define SIZ_TEXT  20                   /* Size of header text */
  1056. #define FNAMESIZE 13                   /* Size of DOS filename */
  1057. #define LFNAMESIZE 256                 /* Size of long filename */
  1058. #define PATHSIZE 256                   /* Max length of pathname */
  1059. typedef struct
  1060.   {
  1061.   char text[SIZ_TEXT];
  1062.   UNS_32 zoo_tag;
  1063.   UNS_32 zoo_start;
  1064.   UNS_32 zoo_minus;
  1065.   char major_ver;
  1066.   char minor_ver;
  1067.   char type;
  1068.   UNS_32 acmt_pos;
  1069.   UNS_16 acmt_len;
  1070.   UNS_16 vdata;
  1071.  
  1072.   }
  1073. zoo_header;
  1074. typedef struct
  1075.   {
  1076.   UNS_32 zoo_tag;
  1077.   char type;
  1078.   char packing_method;
  1079.   UNS_32 next;
  1080.   UNS_32 offset;
  1081.   UNS_16 date;
  1082.   UNS_16 time;
  1083.   UNS_16 file_crc;
  1084.   UNS_32 org_size;
  1085.   UNS_32 size_now;
  1086.   char major_ver;
  1087.   char minor_ver;
  1088.   char deleted;
  1089.   char struc;
  1090.   UNS_32 comment;
  1091.   UNS_16 cmt_size;
  1092.   char fname[FNAMESIZE];
  1093.   UNS_16 var_dir_len;
  1094.   char tz;
  1095.   UNS_16 dir_crc;
  1096.   /* fields for variable part of directory entry follow */
  1097.   char namlen;
  1098.   char dirlen;
  1099.   char lfname[LFNAMESIZE];
  1100.   char dirname[PATHSIZE];
  1101.   UNS_16 system_id;
  1102.   UNS_32 fattr;
  1103.   UNS_16 vflag;
  1104.   UNS_16 version_no;
  1105.  
  1106.   }
  1107. zoo_direntry;
  1108. /*
  1109. *     LHA structure information
  1110. *     courtesy Daniel Durbin
  1111. */
  1112. typedef struct
  1113.   {
  1114.   /* Local file header */
  1115.   char unknown1[2];   /* ? */
  1116.   char method[5];     /* compression method */
  1117.   UNS_32 csize;     /* compressed size */
  1118.   UNS_32 fsize;     /* uncompressed size */
  1119.   UNS_16 ftime;     /* last mod file time (msdos format) */
  1120.   UNS_16 fdate;     /* last mod file date */
  1121.   char fattr;     /* file attributes */
  1122.   char unknown2;      /* ? */
  1123.   char namelen;     /* filename length */
  1124.  
  1125.   }
  1126. LZHead;
  1127. /*
  1128. *     Gif header information
  1129. */
  1130. typedef struct
  1131.   {
  1132.   char   Sig[6];  /* no null */
  1133.   UNS_16 Width;
  1134.   UNS_16 Height;
  1135.   char   Colors;
  1136.  
  1137.   }
  1138. GifHeader;
  1139. /*
  1140. *     Timer Assignments
  1141. */
  1142. #define WORK_TIMER      0       /* scratch timer        */
  1143. #define NEXT_ANYNET     1
  1144. #define USER_TIMER      2
  1145. #define NET_SESSION     3
  1146. /*
  1147. *     Multi-tasking (OS) defines
  1148. */
  1149. #define INUSE_PAUSE 0
  1150. #define IDLE_PAUSE  1
  1151. #define NET_PAUSE 2
  1152. #define CHAT_NICE 3
  1153. /*
  1154. *     Data Entry Types
  1155. */
  1156. #define MSG_ENTRY 0
  1157. #define FILE_ENTRY  1
  1158. #define INFO_ENTRY  2
  1159. #define BIO_ENTRY 3
  1160. /*
  1161. *     Finger saving defines
  1162. */
  1163. #define termWidth       logBuf.lbwidth
  1164. #define termNulls       logBuf.lbnulls
  1165. #define termLF          logBuf.lbflags.LFMASK
  1166. #define expert          logBuf.lbflags.EXPERT
  1167. #define aide            logBuf.lbflags.AIDE
  1168. #define sendTime        logBuf.lbflags.TIME
  1169. #define oldToo          logBuf.lbflags.OLDTOO
  1170. #define FloorMode       logBuf.lbflags.FLOORS
  1171. #define HalfDup         logBuf.lbflags.HALF_DUP
  1172. #define thisFloor       roomBuf.rbFlIndex
  1173. #define DoorPriv        logBuf.lbflags.DOOR_PRIVS
  1174. #define MAILSLOTS       cfg.MailSlots
  1175. #define MSGSPERRM       cfg.MsgsPerrm
  1176. #define MAXROOMS        cfg.MaxRooms
  1177. #define SHARED_ROOMS    cfg.SharedRooms
  1178. /*
  1179. * This is icky, and should be a lesson to all would-be
  1180. * header writers.
  1181. */
  1182. #include "ctdlvirt.h"
  1183. #include "ctdlansi.h"
  1184. #include "ansisys.h"
  1185. /* And that's it for this file */
  1186.